package com.forum.module.blog.dal.mysql.likes;

import com.forum.framework.common.pojo.PageResult;
import com.forum.framework.mybatis.core.mapper.BaseMapperX;
import com.forum.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.forum.module.blog.controller.likes.vo.LikesPageReqVO;
import com.forum.module.blog.dal.dataobject.likes.LikesDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface LikesMapper extends BaseMapperX<LikesDO> {
    default PageResult<LikesDO> selectPage(LikesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LikesDO>()
                .eqIfPresent(LikesDO::getArticleId, reqVO.getArticleId())
                .eqIfPresent(LikesDO::getCommentId, reqVO.getCommentId())
                .eqIfPresent(LikesDO::getUserId, reqVO.getUserId()));
    }
}
